package com.atguigu.guli.service.statistics.controller.admin;


import com.atguigu.guli.service.base.result.R;
import com.atguigu.guli.service.statistics.service.DailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author atguigu
 * @since 2021-08-16
 */
@RestController
@RequestMapping("admin/statistics/daily")
public class AdminDailyController {

    @Autowired
    DailyService dailyService;

    @PostMapping("genDaily/{day}")
    public R genDaily(@PathVariable String day){
        dailyService.genDaily(day);
        return R.ok();
    }

    @GetMapping("/getStatistics/{begin}/{end}")
    public R getStatistics(@PathVariable String begin,@PathVariable String end){
        Map<String ,Object> map = dailyService.getStatistics(begin,end);
        return R.ok().data(map);
    }
}

